﻿@model ProyectoTerminalRetiro.ReferenciaServicioEmpresa.Empresa[]

<!doctype html>
<html>
<head>
    <title>Home</title>
    <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

</head>

<body>

    <h2>Administracion de Empresas</h2>


    <h3>Nueva empresa</h3>

    <form id="formularioAltaEmpresa" method="post">
        <table>
            <thead>
            </thead>
            <tbody>
                <tr>
                    <td><span>Nombre:</span></td>
                    <td>
                        <input type="text" maxlength="50" name="nombre" id="nombre" /></td>
                </tr>
                <tr>
                    <td><span>Codigo:</span></td>
                    <td>
                        <input type="text" maxlength="3" name="codigo" id="codigo" /></td>
                </tr>
                <tr>

                    <td>
                        <input type="submit" value="Guardar" /></td>
                    <td>
                        <button>Limpiar</button></td>
                </tr>
            </tbody>
            <tfoot>
            </tfoot>
        </table>

    </form>



    <br />
    <br />

    <p id="parrafoAdvertencia">&nbsp;</p>

    <br />
    <br />

    <h3>Empresas existentes</h3>

    <table id="tablaEmpresasExistentes">
        <thead>
            <tr>
                <td>Nombre</td>
                <td>Codigo</td>
                <td></td>
            </tr>
        </thead>

        <tbody>

            <!-- fila base para clonar y agregar al final -->
            <tr class="celdasOcultas">
                <td class="celdaNombre"></td>
                <td class="celdaCodigo"></td>
                <td hidden="hidden">
                    <a class="linkEditar">
                        <img src="~/Content/AdmEmpresasDestinos/images/edit.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                    <a class="linkDetalles">
                        <img src="~/Content/AdmEmpresasDestinos/images/detail.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                    <a class="linkEliminar">
                        <img src="~/Content/AdmEmpresasDestinos/images/delete.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                    <a class="linkAdmMicros">
                        <img src="~/Content/AdmEmpresasDestinos/images/addMicro.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                </td>
            </tr>


            @foreach (var empresa in Model)
            {
                <tr>
                    <td>@empresa.Nombre</td>
                    <td>@empresa.Codigo</td>
                    <td>
                        <a href="@Url.Action("Edit", "Empresa", new { id = empresa.Id })" class="linkEditar">
                            <img src="~/Content/AdmEmpresasDestinos/images/edit.png" class="iconos" />
                        </a>&nbsp; &nbsp;
                    <a href="@Url.Action("Details", "Empresa", new { id = empresa.Id })" class="linkDetalles">
                        <img src="~/Content/AdmEmpresasDestinos/images/detail.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                    <a onclick="eliminarEmpresa(@empresa.Id, this)" class="linkEliminar">
                        <img src="~/Content/AdmEmpresasDestinos/images/delete.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                    <a href="@Url.Action("AdministrarMicros", "Empresa", new { id = empresa.Id })" class="linkAdmMicros">
                        <img src="~/Content/AdmEmpresasDestinos/images/addMicro.png" class="iconos" />
                    </a>&nbsp; &nbsp;

                    </td>
                </tr>
            }






        </tbody>
        <tfoot>
        </tfoot>
    </table>

    <script src="~/Content/AdmEmpresasDestinos/scripts/scriptEmpresaIndex.js"></script>
    <script type="text/javascript">
        var urls = {};
        urls.darAltaEmpresa = "@Url.Action("DalAtlaEmpresa", "Empresa")";
        urls.editar = "@Url.Action("Edit", "Empresa")";
        urls.detalles = "@Url.Action("Details", "Empresa")";
        urls.eliminar = "@Url.Action("Delete", "Empresa")"; 
        urls.admmicros = "@Url.Action("AdministrarMicros", "Empresa")"; 
        urls.eliminarEmpresa = "@Url.Action("EliminarEmpresa", "Empresa")"; 
        
    </script>



</body>
</html>
